<div class="x_page-header">
	<h1>{$lang->installed_addons}</h1>
</div>
<h2>{$addon_info->title}</h2>
<table class="x_table">
	<tbody>
		<tr>
			<th class="nowr">{$lang->version}</th>
			<td>{$addon_info->version} ({zdate($addon_info->date, 'Y-m-d')})</td>
		</tr>
		<tr>
			<th class="nowr">{$lang->author}</th>
			<td>
				<block loop="$addon_info->author => $author">
					{$author->name} (<a cond="$author->homepage" href="{$author->homepage}" target="_blank">{$author->homepage}</a>, <a cond="$author->email_address" href="mailto:{$author->email_address}">{$author->email_address}</a>) <br />
				</block>
			</td>
		</tr>
		<tr cond="$addon_info->homepage">
			<th class="nowr">{$lang->homepage}</th>
			<td><a href="{$addon_info->homepage}" target="_blank">{$addon_info->homepage}</a></td>
		</tr>
		<tr cond="$addon_info->license">
			<th class="nowr">{$lang->addon_license}</th>
			<td><a href="{$addon_info->license_link}"|cond="$addon_info->license_link" target="_blank">{$addon_info->license}</a></td>
		</tr>
		<tr cond="$addon_info->description">
			<th class="nowr">{$lang->description}</th>
			<td>{$addon_info->description}</td>
		</tr>
	</tbody>
</table>
<div cond="$XE_VALIDATOR_MESSAGE && $XE_VALIDATOR_ID == 'modules/addon/tpl/setup_addon/1'" class="message {$XE_VALIDATOR_MESSAGE_TYPE}">
	<p>{$XE_VALIDATOR_MESSAGE}</p>
</div>
<form action="./" method="post" class="x_form-horizontal">
<section class="section">
	<input type="hidden" name="module" value="{$module}" />
	<input type="hidden" name="act" value="procAddonAdminSetupAddon" />
	<input type="hidden" name="addon_name" value="{$addon_info->addon_name}" />
	<input type="hidden" name="xe_validator_id" value="modules/addon/tpl/setup_addon/1" />

	<block cond="count($addon_info->extra_vars)">
		<block loop="$addon_info->extra_vars => $id, $var">
			<block cond="$group != $var->group">
				<h2>{$var->group}</h2>
				{@$group = $var->group}
			</block>
			{@$not_first = true}
			<div class="x_control-group" cond="!$not_first && $group != $var->group"></div>
			<div class="x_control-group">
				<label class="x_control-label" for="{$var->name}"|cond="$var->type != 'textarea'" for="lang_{$var->name}"|cond="$var->type == 'textarea'">{$var->title}</label>
				<div class="x_controls">
					<input cond="$var->type == 'text'" type="text" name="{$var->name}" id="{$var->name}" value="{htmlspecialchars($var->value)}">
					<textarea cond="$var->type == 'textarea'" name="{$var->name}" id="{$var->name}" class="lang_code" rows="8" cols="42">{htmlspecialchars($var->value)}</textarea>
					<select cond="$var->type == 'select'" name="{$var->name}" id="{$var->name}">
						<option loop="$var->options => $option" value="{$option->value}" selected="selected"|cond="$var->value == $option->value">{$option->title}</option>
					</select>
					<span class="x_help-inline">{nl2br($var->description)}</span>
				</div>
			</div>
		</block>
	</block>
	<div cond="!count($addon_info->extra_vars)" class="message info">
		<p>{$lang->msg_not_exist_option}</p>
	</div>
</section>

<section class="section">
	<block cond="$mid_list">
		<h1>{$lang->target}</h1>
		<div class="x_control-group">{$lang->about_addon_mid}</div>
		<div class="x_control-group">
			<label class="x_control-label">{$lang->run_method}</label>
			<div class="x_controls">
				<select name="xe_run_method">
					<option value="run_selected" selected="selected"|cond="$addon_info->xe_run_method === 'run_selected'">{$lang->run_selected_module}</option>
					<option value="no_run_selected" selected="selected"|cond="$addon_info->xe_run_method === 'no_run_selected'">{$lang->no_run_selected_module}</option>
				</select>
			</div>
		</div>

		<div class="x_control-group">
			<label class="x_control-label">{$lang->target}</label>
			<div class="x_controls">
				<label for="check_all"><input type="checkbox" id="check_all" /> Check all</label>
				<block  loop="$mid_list => $module_category_srl, $modules">
				<!--@if(count($mid_list) > 1)-->
				<fieldset>
					<legend><!--@if($modules->title)-->{$modules->title}<!--@else-->{$lang->none_category}<!--@end--></legend>
				<!--@end-->
					<label loop="$modules->list => $key, $val">
						<input type="checkbox" value="{$key}" name="mid_list[]" id="chk_mid_list_{$key}" checked="checked"|cond="in_array($key, $addon_info->mid_list)"/>
						{$key} ({$val->browser_title})
					</label>
				<!--@if(count($mid_list) > 1)-->
				</fieldset>
				<!--@end-->
				</block>
			</div>
		</div>
	</block>
	<div class="x_clearfix btnArea">
		<div class="x_pull-right">
			<button type="submit" class="x_btn x_btn-primary">{$lang->cmd_save}</button>
		</div>
	</div>
</block>
</section>
</form>
<script>
(function($){
	$('#check_all')
		.bind('click', function(e){
			if (this.checked){
				$('input[name=mid_list\\[\\]]').attr('checked', 'checked');
			}else{
				$('input[name=mid_list\\[\\]]').removeAttr('checked');
			}
		});
})(jQuery);
</script>
